<?php

namespace app\api\validate;

use think\Validate;
/**
 *
 * 未完成
 */
class ExpressScene extends Validate
{
    protected $rule = [
//        'id' => ["require","number"],
//        'contact_name' => ['require','length'=>'1,10'],
//        "buy_num" => ['number','require'],
//        "telephone" => ['regex'=>'/^1[3-9]{1}[0-9]{9}$/','require'],
//        "goods_name" => ['length'=>'1,20','require'],
//        "express_num" => ['number','require'],
//        "express_name" => ['length'=>'1,10','require'],
//        "data_state" => ['number','require'],
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
//        'contact_name.require' => '联系人不能为空',
//        'contact_name.length' => '联系人长度为1-10个字符',
//        'buy_num.number' => '复购次数只能为数值',
//        'buy_num.require' => '复购次数不能为空',
//        'telephone.regex' => '电话号码格式不正确',
//        'telephone.require' => '电话号码不能为空',
//        'goods_name.length' => '产品名称的长度为1-20个字符',
//        'goods_name.require' => '产品名称不能为空',
//        'express_num.require' => '快递单号不能为空',
//        'express_name.number' => '快递公司名称的长度为1-10个字符',
//        'express_name.require' => '快递公司名称不能为空',
        'id.require' => '快递ID不能为空',
        'id.number' => '快递ID只能为数值',
        'data_state.number' =>'数据状态必须为数值',
        'data_state.require' =>'未设置状态',
    ];

    protected $scene = [
        'add'  =>  ['contact_name','buy_num','telephone','goods_name','express_num','express_name'],
        'update'  =>  ['id','contact_name','buy_num','telephone','goods_name','express_num','express_name'],
        'update_state' => ['id',"data_state"]
    ];
}